*** Municipal-level models: decapitation and inter-cartel wars
* Table 2
use "data-mun-level.dta",clear
xtset cve_inegi year
set more off

**************************************************  MAIN PAPER  *******************************************

**********  Table 3
**** Decapitation
*** OLS
** FE
* Count DV
eststo clear
eststo: xtreg count decap_jcr_dummy lag1_homrate mpoff1000 i.year, i(cve_inegi) fe
	estadd local munfe  "Y" 
	estadd local yearfe  "Y"
	estadd local timeperiod  "1998-2010"

* Dummy DV
eststo: xtreg count_dummy decap_jcr_dummy lag1_homrate mpoff1000 i.year, i(cve_inegi) fe
	estadd local munfe  "Y" 
	estadd local yearfe  "Y"
	estadd local timeperiod  "1998-2010"

**** Inter-cartel wars
eststo: xtreg count cvmr1000 mpoff1000 i.year, i(cve_inegi) fe
	estadd local munfe  "Y" 
	estadd local yearfe  "Y" 
	estadd local timeperiod  "1995-2012"

eststo: xtreg count cvmr1000dummy mpoff1000 i.year, i(cve_inegi) fe
	estadd local munfe  "Y" 
	estadd local yearfe  "Y" 
	estadd local timeperiod  "1995-2012"

eststo: xtreg count_dummy cvmr1000 mpoff1000 i.year, i(cve_inegi) fe
	estadd local munfe  "Y" 
	estadd local yearfe  "Y" 
	estadd local timeperiod  "1995-2012"

eststo: xtreg count_dummy cvmr1000dummy mpoff1000 i.year, i(cve_inegi) fe
	estadd local munfe  "Y" 
	estadd local yearfe  "Y" 
	estadd local timeperiod  "1995-2012"


esttab using "Table3.rtf", replace cell(b(star fmt (3)) se(par)) ///
	   mtitles("Count DV" "Dummy DV" "Count DV" "Count DV" "Dummy DV" "Dummy DV") ///
       uns drop(_cons *.year mpoff1000 lag1_homrate) compress fonttbl(\f0\fnil Garamond; )  ///
       stats(N munfe yearfe timeperiod, fmt(%9.0g) labels("N" "Municipal FE" "Year FE" "Time period")) starlevels(+ 0.1 * 0.05 ** 0.01 *** 0.001)  ///
	   note("Note: Entries are coefficients from OLS regressions with standard errors in parenthesis. All models control for the number of Public Prosecutors per 10,000 population. Models 1 and 2 also control for the municipal homicide rate in t-1. + p<0.1; * p<0.05; ** p<0.01; *** p<0.001")  ///
	   varlabels(decap_jcr_dummy Decapitation cvmr1000 "Inter-cartel violence" cvmr1000dummy "Inter-cartel violence (dummy)" lag1_homrate "Homicide rate (t-1)" mpoff1000 "Prosecutors per 100,000") ///
	   title("Table 3. Cartel Decapitation and Inter-cartel Wars Predict Attacks on Journalists by Mexican Municipality ")

********** Table 4: criminal governance
eststo clear
*** OLS
** FE (1 lag)
eststo: reghdfe count L.aggr_sum lag1_homrate mpoff1000, cluster(cve_inegi) absorb(cve_inegi year)
	estadd local munfe  "Y" 
	estadd local yearfe  "Y"
	estadd local controls  "Y"

** FE (sum of 2 lags)
eststo: reghdfe count att_lags2 lag1_homrate mpoff1000, cluster(cve_inegi) absorb(cve_inegi year)
	estadd local munfe  "Y" 
	estadd local yearfe  "Y"
	estadd local controls  "Y"
	
** FE (sum of 3 lags)
eststo: reghdfe count att_lags3 lag1_homrate mpoff1000, cluster(cve_inegi) absorb(cve_inegi year)
	estadd local munfe  "Y" 
	estadd local yearfe  "Y"
	estadd local controls  "Y"

	
** FE (sum of 4 lags)
eststo: reghdfe count att_lags4 lag1_homrate mpoff1000, cluster(cve_inegi) absorb(cve_inegi year)
	estadd local munfe  "Y" 
	estadd local yearfe  "Y"
	estadd local controls  "Y"

** FE (sum of 5 lags)
eststo: reghdfe count att_lags5 lag1_homrate mpoff1000, cluster(cve_inegi) absorb(cve_inegi year)
	estadd local munfe  "Y" 
	estadd local yearfe  "Y"
	estadd local controls  "Y"


esttab using "Table4.rtf", cell(b(star fmt (%9.2f)) se(par)) ///
       uns  drop(lag1_homrate mpoff1000 _cons) compress fonttbl(\f0\fnil Garamond; ) ///
       stats(N munfe yearfe controls, fmt(%9.0g) labels("N" "Municipal FE" "Year FE" "Controls")) ///
	   	   varlabels(L.aggr_sum "Attacks on authorities (one lag)" att_lags2 "Attacks on authorities (sum of 2 lags)" att_lags3 "Attacks on authorities (sum of 3 lags)" att_lags4 "Attacks on authorities (sum of 4 lags)" att_lags5 "Attacks on authorities (sum of 5 lags)") ///
	   starlevels(+ 0.1 * 0.05 ** 0.01 *** 0.001) label ///
	   title("Table 4. Criminal Governance and Attacks on Journalists by Mexican Municipality, 1995–2012") mtitles replace


********** Table 5
**** Effect of disappearances on assassination of journalists
** OLS
* TWFE
eststo clear
eststo: reghdfe count disap_num lag1_homrate mpoff1000, cluster(cve_inegi) absorb(cve_inegi year)
	estadd local munfe  "Y" 
	estadd local yearfe  "Y"
	estadd local mod  "OLS FE"
	estadd local controls  "Y"

esttab using "Table 5.rtf", replace cell(b(star fmt (2)) se(par)) ///
       uns  compress fonttbl(\f0\fnil Garamond; )  ///
	   keep(disap_num) ///
       stats(N munfe yearfe controls mod, fmt(%9.0g) labels("N" "Municipal FE" "Year FE" "Controls" "Model")) starlevels(+ 0.1 * 0.05 ** 0.01 *** 0.001)  ///
	   note("Note: Entries are coefficients from OLS regressions with standard errors in parenthesis. + p<0.1; * p<0.05; ** p<0.01; *** p<0.001")  ///
	   varlabels(disap_num "Number of Disappearances") ///
	   title("Table 5. Disappearances and the Assassination of Journalists by Mexican Municipality, 1995-2012")

*******************************************  APPENDIX  *******************************************

********** Table A.IV.c
*** NB
eststo clear
** Decapitation count
* FE
eststo: xtnbreg count decap_jcr_count lag1_homrate mpoff1000, i(cve_inegi) fe
		estadd local modelt "FE"
		estadd local controls "Y"
* IRR
xtnbreg count decap_jcr_count lag1_homrate mpoff1000, i(cve_inegi) fe irr
		
* RE
eststo: xtnbreg count decap_jcr_count lag1_homrate mpoff1000, i(cve_inegi) re
		estadd local modelt "RE"
		estadd local controls "Y"
* IRR
xtnbreg count decap_jcr_count lag1_homrate mpoff1000, i(cve_inegi) re irr

** Decapitation dummy
* FE
eststo: xtnbreg count decap_jcr_dummy lag1_homrate mpoff1000, i(cve_inegi) fe
		estadd local modelt "FE"
		estadd local controls "Y"
* IRR
xtnbreg count decap_jcr_dummy lag1_homrate mpoff1000, i(cve_inegi) fe irr

* RE
eststo: xtnbreg count decap_jcr_dummy lag1_homrate mpoff1000, i(cve_inegi) re
		estadd local modelt "RE"
		estadd local controls "Y"
* IRR
eststo: xtnbreg count decap_jcr_dummy lag1_homrate mpoff1000, i(cve_inegi) re irr
	
esttab using "Table A.IV.c.rtf", replace cell(b(star fmt (2)) se(par)) ///
       uns drop(_cons mpoff1000 lag1_homrate) compress fonttbl(\f0\fnil Garamond; )  ///
       stats(N modelt controls, fmt(%9.0g) labels("N" "Model" "Controls")) starlevels(+ 0.1 * 0.05 ** 0.01 *** 0.001)  ///
	   note("Note: Entries are coefficients from negative binomial regressions with standard errors in parenthesis. + p<0.1; * p<0.05; ** p<0.01; *** p<0.001")  ///
	   varlabels(decap_jcr_count "Decapitation (count)" decap_jcr_dummy "Decapitation (dummy)" lag1_homrate "Homicide rate (t-1)" mpoff1000 "Prosecutors per 100,000") ///
	   title("Table A.IV.c. The Impact of Cartel Decapitation Strategy on Attacks on Journalists by Mexican Municipality (Negative Binomial Models)")

	   
********** Table A.IV.d
eststo clear
eststo: relogit count_dummy decap_jcr_count lag1_homrate mpoff1000, cluster(cve_inegi)
		estadd local modelt "Logit"
		estadd local controls "Y"
		
eststo: relogit count_dummy decap_jcr_dummy lag1_homrate mpoff1000, cluster(cve_inegi)
		estadd local modelt "Logit"
		estadd local controls "Y"

esttab using "Table A.IV.d.rtf", replace cell(b(star fmt (2)) se(par)) ///
       uns drop(_cons mpoff1000 lag1_homrate) compress fonttbl(\f0\fnil Garamond; )  ///
       stats(N modelt controls, fmt(%9.0g) labels("N" "Model" "Controls")) starlevels(+ 0.1 * 0.05 ** 0.01 *** 0.001)  ///
	   note("Note: Entries are coefficients from negative binomial regressions with standard errors in parenthesis. + p<0.1; * p<0.05; ** p<0.01; *** p<0.001")  ///
	   varlabels(decap_jcr_count "Decapitation (count)" decap_jcr_dummy "Decapitation (dummy)" lag1_homrate "Homicide rate (t-1)" mpoff1000 "Prosecutors per 100,000") ///
	   title("Table A.IV.d. The Impact of Cartel Decapitation Strategy on Attacks on Journalists by Mexican Municipality (Rare Event Logistic Regressions)")

********** Table A.IV.e
*** NB
eststo clear
** Inter-cartel violence (count)
* FE
eststo: xtnbreg count cvmr1000 mpoff1000, i(cve_inegi) fe
		estadd local modelt "FE"
		estadd local controls "Y"

* RE
eststo: xtnbreg count cvmr1000 mpoff1000 , i(cve_inegi) re
		estadd local modelt "RE"
		estadd local controls "Y"
		

** Inter-cartel violence (dummy)
* FE
eststo: xtnbreg count cvmr1000dummy mpoff1000, i(cve_inegi) fe
		estadd local modelt "FE"
		estadd local controls "Y"

* RE
eststo: xtnbreg count cvmr1000dummy mpoff1000 , i(cve_inegi) re
		estadd local modelt "RE"
		estadd local controls "Y"
		
esttab using "Table A.IV.e.rtf", replace cell(b(star fmt (2)) se(par)) ///
       uns drop(_cons mpoff1000) compress fonttbl(\f0\fnil Garamond; )  ///
       stats(N modelt controls, fmt(%9.0g) labels("N" "Model" "Controls")) starlevels(+ 0.1 * 0.05 ** 0.01 *** 0.001)  ///
	   note("Note: Entries are coefficients from negative binomial regressions with standard errors in parenthesis. + p<0.1; * p<0.05; ** p<0.01; *** p<0.001")  ///
	   varlabels(cvmr1000 "Inter-cartel violence" cvmr1000dummy "Inter-cartel violence (dummy)" mpoff1000 "Prosecutors per 100,000") ///
	   title("Table A.IV.e. The Impact of Inter-Cartel Wars on the Assassination vs. Journalists by Mexican Municipality (Negative Binomial Models)")

   
********** Table A.IV.f
eststo: relogit count_dummy cvmr1000 mpoff1000, cluster(cve_inegi)
		estadd local modelt "Logit"
		estadd local controls "Y"		
		
eststo: relogit count_dummy cvmr1000dummy mpoff1000, cluster(cve_inegi)
		estadd local modelt "Logit"
		estadd local controls "Y"

esttab using "Table A.IV.f.rtf", replace cell(b(star fmt (2)) se(par)) ///
       uns drop(_cons mpoff1000) compress fonttbl(\f0\fnil Garamond; )  ///
       stats(N modelt controls, fmt(%9.0g) labels("N" "Model" "Controls")) starlevels(+ 0.1 * 0.05 ** 0.01 *** 0.001)  ///
	   note("Note: Entries are coefficients from negative binomial regressions with standard errors in parenthesis. + p<0.1; * p<0.05; ** p<0.01; *** p<0.001")  ///
	   varlabels(cvmr1000 "Inter-cartel violence" cvmr1000dummy "Inter-cartel violence (dummy)" mpoff1000 "Prosecutors per 100,000") ///
	   title("Table A.IV.f. The Impact of Inter-Cartel Wars on the Assassination vs. Journalists by Mexican Municipality (Rare Event Logistic Regressions)")

	
********** Table A.IV.g
** RE (1 lag)
eststo clear
eststo: xtreg count L.aggr_sum lag1_homrate mpoff1000, i(cve_inegi) re
	estadd local controls  "Y"
	estadd local mod  "OLS RE"
   
** RE (2 lags)
eststo: xtreg count att_lags2 lag1_homrate mpoff1000, i(cve_inegi) re
	estadd local controls  "Y"
	estadd local mod  "OLS RE"
	
** RE (3 lags)
eststo: xtreg count att_lags3 lag1_homrate mpoff1000, i(cve_inegi) re
	estadd local controls  "Y"
	estadd local mod  "OLS RE"

** RE (4 lags)
eststo: xtreg count att_lags4 lag1_homrate mpoff1000, i(cve_inegi) re
	estadd local controls  "Y"
	estadd local mod  "OLS RE"

** RE (5 lags)
eststo: xtreg count att_lags5 lag1_homrate mpoff1000, i(cve_inegi) re
	estadd local controls  "Y"
	estadd local mod  "OLS RE"

*** NB	
**RE 
* 1 lags
eststo: xtnbreg count L.aggr_sum lag1_homrate mpoff1000, i(cve_inegi) re irr

* 2 lags
eststo: xtnbreg count att_lags2 lag1_homrate mpoff1000, i(cve_inegi) re irr
	estadd local controls  "Y"
	estadd local mod  "NB RE"

* 3 lags
eststo: xtnbreg count att_lags3 lag1_homrate mpoff1000, i(cve_inegi) re irr
	estadd local controls  "Y"
	estadd local mod  "NB RE"


* 4 lags
eststo: xtnbreg count att_lags4 lag1_homrate mpoff1000, i(cve_inegi) re irr
	estadd local controls  "Y"
	estadd local mod  "NB RE"
	
* 5 lags
eststo: xtnbreg count att_lags5 lag1_homrate mpoff1000, i(cve_inegi) re irr
	estadd local controls "Y"
	estadd local mod  "NB RE"
	
esttab using "Table A.IV.g.rtf", cell(b(star fmt (%9.2f)) se(par)) ///
       uns  drop(lag1_homrate mpoff1000 _cons) compress fonttbl(\f0\fnil Garamond; ) ///
       stats(N controls mod, fmt(%9.0g) labels("N" "Controls" "Model")) ///
	   starlevels(+ 0.1 * 0.05 ** 0.01 *** 0.001) label ///
	   title("Table A.IV.g. Criminal Governance and Attacks on Journalists by Mexican Municipality (Random Effects Models)") mtitles replace



********** Table A.IV.h
* OLS RE
eststo clear
eststo: xtreg count disap_num lag1_homrate mpoff1000, re vce(cluster cve_inegi)
	estadd local mod  "RE"
	estadd local controls  "Y"

* NB RE
eststo: xtnbreg count disap_num lag1_homrate mpoff1000, i(cve_inegi) re
	estadd local mod  "RE"
	estadd local controls  "Y"

esttab using "Table A.IV.h.rtf", replace cell(b(star fmt (2)) se(par)) ///
       uns  compress fonttbl(\f0\fnil Garamond; )  ///
	   keep(disap_num) ///
       stats(N controls mod, fmt(%9.0g) labels("N" "Controls" "Model")) starlevels(+ 0.1 * 0.05 ** 0.01 *** 0.001)  ///
	   note("Note: Entries are coefficients from OLS regressions with standard errors in parenthesis. + p<0.1; * p<0.05; ** p<0.01; *** p<0.001")  ///
	   varlabels(disap_num "Number of Disappearances") ///
	   title("Table A.IV.h. Disappearances and the Assassination of Journalists by Mexican Municipality")


********** Table A.VII.a
** Election Cycles
eststo clear
* OLS FE
eststo: reghdfe count mun_cycle gov_cycle, cluster(cve_inegi) absorb(cve_inegi year)
	estadd local munfe  "Y" 
	estadd local yearfe  "Y"
	estadd local mod  "OLS"
	estadd local controls  "Y"

* OLS RE
eststo: xtreg count mun_cycle gov_cycle, cluster(cve_inegi) re
	estadd local munfe  "" 
	estadd local yearfe  ""
	estadd local mod  "OLS"
	estadd local controls  "Y"

* NB FE
eststo: xtnbreg count mun_cycle gov_cycle i.year, i(cve_inegi) fe
	estadd local munfe  "Y" 
	estadd local yearfe  "Y"
	estadd local mod  "NB"
	estadd local controls  "Y"

* NB RE
eststo: xtnbreg count mun_cycle gov_cycle, i(cve_inegi) re
	estadd local munfe  "" 
	estadd local yearfe  ""
	estadd local mod  "NB"
	estadd local controls  "Y"

esttab using "Table A.VII.a.rtf", replace cell(b(star fmt (2)) se(par)) ///
       uns drop(_cons *.year) compress fonttbl(\f0\fnil Garamond; )  ///
       stats(N mod munfe yearfe controls, fmt(%9.0g) labels("N" "Model" "Municipal FE" "Year FE" "Controls")) ///
	   starlevels(+ 0.1 * 0.05 ** 0.01 *** 0.001)  ///
	   note("Note: Clustered standard errors in parenthesis. + p<0.1; * p<0.05; ** p<0.01; *** p<0.001")  ///
	   varlabels(mun_cycle "Municipal election" gov_cycle "State election") ///
	   title("Table A.VII.a. The Impact of Election Cycles on the Assassination of Journalists")


********** Table A.VII.b
** Electoral Competition
eststo clear
* OLS FE
eststo: reghdfe count enp_mun enp_st lag1_homrate mpoff1000, cluster(cve_inegi) absorb(cve_inegi year)
	estadd local munfe  "Y" 
	estadd local yearfe  "Y"
	estadd local mod  "OLS"
	estadd local controls  "Y"

* OLS RE
eststo: xtreg count enp_mun enp_st lag1_homrate mpoff1000, cluster(cve_inegi) re
	estadd local munfe  "" 
	estadd local yearfe  ""
	estadd local mod  "OLS"
	estadd local controls  "Y"

* NB FE
eststo: xtnbreg count enp_mun enp_st lag1_homrate mpoff1000 i.year, i(cve_inegi) fe
	estadd local munfe  "Y" 
	estadd local yearfe  "Y"
	estadd local mod  "NB"
	estadd local controls  "Y"

* NB RE
eststo: xtnbreg count enp_mun enp_st lag1_homrate mpoff1000, i(cve_inegi) re
	estadd local munfe  "" 
	estadd local yearfe  ""
	estadd local mod  "NB"
	estadd local controls  "Y"

	
esttab using "Table A.VII.b.rtf", replace cell(b(star fmt (2)) se(par)) ///
       uns drop(_cons mpoff1000 lag1_homrate *.year) compress fonttbl(\f0\fnil Garamond; )  ///
       stats(N mod munfe yearfe controls, fmt(%9.0g) labels("N" "Model" "Municipal FE" "Year FE" "Controls")) ///
	   starlevels(+ 0.1 * 0.05 ** 0.01 *** 0.001)  ///
	   note("Note: Clustered standard errors in parenthesis. Controls include the number of Prosecutors per 100,000 population and homicide rates in t-1. + p<0.1; * p<0.05; ** p<0.01; *** p<0.001")  ///
	   varlabels(enp_mun "Municipal electoral competition" enp_st "State electoral competition" number_cartels "Number of cartels" ) ///
	   title("Table A.VII.b. The Impact of Party Alternations on the Assassination of Journalists")

********** Table A.VII.c
** Alternation
eststo clear
* OLS FE
eststo: reghdfe count alternancia_st alternancia_mun lag1_homrate mpoff1000, cluster(cve_inegi) absorb(cve_inegi year)
	estadd local munfe  "Y" 
	estadd local yearfe  "Y"
	estadd local mod  "OLS"
	estadd local controls  "Y"

* OLS RE
eststo: xtreg count alternancia_st alternancia_mun lag1_homrate mpoff1000, cluster(cve_inegi) re
	estadd local munfe  "" 
	estadd local yearfe  ""
	estadd local mod  "OLS"
	estadd local controls  "Y"

* NB FE
eststo: xtnbreg count alternancia_st alternancia_mun lag1_homrate mpoff1000 i.year, i(cve_inegi) fe
	estadd local munfe  "Y" 
	estadd local yearfe  "Y"
	estadd local mod  "NB"
	estadd local controls  "Y"

* NB RE
eststo: xtnbreg count alternancia_st alternancia_mun lag1_homrate mpoff1000, i(cve_inegi) re
	estadd local munfe  "" 
	estadd local yearfe  ""
	estadd local mod  "NB"
	estadd local controls  "Y"

	
esttab using "Table A.VII.c.rtf", replace cell(b(star fmt (2)) se(par)) ///
       uns drop(_cons mpoff1000 lag1_homrate *.year) compress fonttbl(\f0\fnil Garamond; )  ///
       stats(N mod munfe yearfe controls, fmt(%9.0g) labels("N" "Model" "Municipal FE" "Year FE" "Controls")) ///
	   starlevels(+ 0.1 * 0.05 ** 0.01 *** 0.001)  ///
	   note("Note: Clustered standard errors in parenthesis. Controls include the number of Prosecutors per 100,000 population and homicide rates in t-1. + p<0.1; * p<0.05; ** p<0.01; *** p<0.001")  ///
	   varlabels(alternancia_st "State alternation" alternancia_mun "Municipal alternation") ///
	   title("Table A.VII.c. The Impact of Party Alternations on the Assassination of Journalists")

********** Table A.VII.d
eststo clear
** Decapitations
eststo: xtnbreg count decap_jcr_dummy lag1_homrate mpoff1000 rural, i(cve_inegi) re

** Inter-cartel wars (count)
eststo: xtnbreg count cvmr1000 lag1_homrate mpoff1000 rural, i(cve_inegi) re

** Inter-cartel wars (dummy)
eststo: xtnbreg count cvmr1000dummy lag1_homrate mpoff1000 rural, i(cve_inegi) re

** Criminal governance
eststo: xtnbreg count att_lags3 lag1_homrate mpoff1000 rural, i(cve_inegi) re
	
** Disappearances
eststo: xtnbreg count disap_num lag1_homrate mpoff1000 rural, i(cve_inegi) re

esttab using "Table A.VII.d.rtf", replace cell(b(star fmt (2)) se(par)) ///
       uns drop(_cons) compress fonttbl(\f0\fnil Garamond; )  ///
   	   o(decap_jcr_dummy cvmr1000 cvmr1000dummy att_lags3 disap_num) ///
       stats(N, fmt(%9.0g)) starlevels(+ 0.1 * 0.05 ** 0.01 *** 0.001)  ///
	   note("Note: Entries are coefficients from negative binomial regressions with standard errors in parenthesis. + p<0.1; * p<0.05; ** p<0.01; *** p<0.001")  ///
   	   varlabels(decap_jcr_dummy Decapitation cvmr1000 "Inter-cartel violence" cvmr1000dummy "Inter-cartel violence (dummy)" lag1_homrate "Homicide rate (t-1)" ///
	   mpoff1000 "Prosecutors per 100,000" disap_num "Number of disappearances" ///
	   att_lags3 "Criminal governance"  number_cartels "Number of cartels" cvmr1000 "Inter-cartel violence") ///
	   title("able A.VII.d. The Conflict Dynamics Unleashed by the War on Drugs and the Assassination of Journalists by Mexican Municipality, Controlling for Municipal Rurality")


********** Table A.VII.e
eststo clear
*** Subset of urban
** Decapitations
eststo: reghdfe count decap_jcr_dummy lag1_homrate mpoff1000  if rural ==0, cluster(cve_inegi) absorb(cve_inegi year)

** Inter-cartel wars (dummy)
eststo: reghdfe count cvmr1000dummy lag1_homrate mpoff1000 if rural ==0, cluster(cve_inegi) absorb(cve_inegi year)

** Criminal governance
eststo: reghdfe count att_lags3 lag1_homrate mpoff1000 if rural ==0, cluster(cve_inegi) absorb(cve_inegi year)

** Disappearances
eststo: reghdfe count disap_num lag1_homrate mpoff1000 if rural ==0, cluster(cve_inegi) absorb(cve_inegi year)


*** Subset of rural
** Decapitations
eststo: reghdfe count decap_jcr_dummy lag1_homrate mpoff1000  if rural ==1, cluster(cve_inegi) absorb(cve_inegi year)

** Inter-cartel wars (dummy)
eststo: reghdfe count cvmr1000dummy lag1_homrate mpoff1000 if rural ==1, cluster(cve_inegi) absorb(cve_inegi year)

** Criminal governance
eststo: reghdfe count att_lags3 lag1_homrate mpoff1000 if rural ==1, cluster(cve_inegi) absorb(cve_inegi year)

** Disappearances
eststo: reghdfe count disap_num lag1_homrate mpoff1000 if rural ==1, cluster(cve_inegi) absorb(cve_inegi year)

esttab using "Table A.VII.e.rtf", replace cell(b(star fmt (2)) se(par)) ///
       uns drop(_cons) compress fonttbl(\f0\fnil Garamond; )  ///
   	   mtitles(Urban Urban Urban Urban Rural Rural Rural Rural) ///
   	   o(decap_jcr_dummy cvmr1000dummy att_lags3 disap_num) ///
       stats(N, fmt(%9.0g)) starlevels(+ 0.1 * 0.05 ** 0.01 *** 0.001)  ///
	   note("Note: Entries are coefficients from negative binomial regressions with standard errors in parenthesis. + p<0.1; * p<0.05; ** p<0.01; *** p<0.001")  ///
   	   varlabels(decap_jcr_dummy Decapitation cvmr1000 "Inter-cartel violence" cvmr1000dummy "Inter-cartel violence (dummy)" lag1_homrate "Homicide rate (t-1)" ///
	   mpoff1000 "Prosecutors per 100,000" disap_num "Number of Disappearances" ///
	   att_lags3 "Criminal governance" number_cartels "Number of cartels" cvmr1000 "Inter-cartel violence") ///
	   title("Table A.VII.e. The Conflicts Unleashed by the War on Drugs and the Assassination of Journalists by Mexican Municipality, Subgroup Analysis: Rural versus Urban")

********** Table A.VII.f
*** Are all cartels equally dangerous?
gen Beltran_Leyva_all = 0
replace Beltran_Leyva_all = 1 if Beltran_Leyva == 1 | Beltran_Leyva_Family ==1
gen Sinaloa_all = 0
replace Sinaloa_all = 1 if Sinaloa == 1 | Sinaloa_Family ==1

eststo clear
eststo: xtnbreg count Beltran_Leyva_all Familia Golfo Juarez Sinaloa_all Tijuana Zetas Otros lag1_homrate mpoff1000 rural, i(cve_inegi) re irr

esttab using "Table A.VII.f.rtf", replace cell(b(star fmt (2)) se(par)) eform ///
       uns drop(_cons ln_r ln_s) compress fonttbl(\f0\fnil Garamond; )  ///
       stats(N, fmt(%9.0g)) starlevels(+ 0.1 * 0.05 ** 0.01 *** 0.001)  ///
	   note("Note: Entries are incidence-rate ratios (IRR) from negative binomial regressions with standard errors in parenthesis. + p<0.1; * p<0.05; ** p<0.01; *** p<0.001")  ///
	   title("Table A.VII.f. Which Cartels Are More Dangerous for Journalists")

********** Table A.VII.g
** effects of complaints on journalist killings
eststo: reghdfe count subsetSECFORCESpc lag1_homrate mpoff1000, cluster(cve_inegi) absorb(cve_inegi year)
	estadd local munfe  "Y" 
	estadd local yearfe  "Y"


********** Table A.VIII.a
eststo clear
eststo: reghdfe number_cartels decap_jcr_dummy lag1_homrate mpoff1000, cluster(cve_inegi) absorb(cve_inegi year)
	estadd local munfe  "Y" 
	estadd local yearfe  "Y"
	estadd local controls  "Y"
	estadd local timeperiod "1994-2010"

esttab using "Table A.VIII.a.rtf", cell(b(star fmt (%9.2f)) se(par))  ///
       uns keep(decap_jcr_dummy) compress fonttbl(\f0\fnil Garamond; ) ///
	   note("Note: Entries are coefficients from OLS regressions. Standard errors clustered at the state level in parenthesis. + p<0.1; * p<0.05; ** p<0.01; *** p<0.001")  ///
       stats(N munfe yearfe controls timeperiod, fmt(%9.0g) labels("N" "Municipal FE" "Year FE" "Controls" "Time Period")) ///
	   starlevels(+ 0.1 * 0.05 ** 0.01 *** 0.001) ///
	   o(decap_jcr_dummy number_cartels lag1_homrate mpoff1000) ///
	   varlabels(decap_jcr_dummy "Decapitation" lag1_homrate "Homicide rate (t-1)" mpoff1000 "Prosecutors per 100,000") ///
	   title("Table A.VIII.a. The Impact of Decapitation on Cartel Fragmentation by Mexican Municipality") replace


********** Table A.VIII.b
eststo clear
eststo: reghdfe count number_cartels lag1_homrate mpoff1000, cluster(cve_inegi) absorb(cve_inegi year)
	estadd local munfe  "Y" 
	estadd local yearfe  "Y" 
	estadd local controls  "Y"
	estadd local timeperiod "1994-2010"

eststo: reghdfe count_dummy number_cartels lag1_homrate mpoff1000, cluster(cve_inegi) absorb(cve_inegi year)
	estadd local munfe  "Y" 
	estadd local yearfe  "Y" 
	estadd local controls  "Y"
	estadd local timeperiod "1994-2010"


esttab using "Table A.VIII.b.rtf", cell(b(star fmt (%9.2f)) se(par))  ///
       uns keep(number_cartels) mtitles("Journalists murdered (count)" "Journalists murdered (dummy)")  ///
	   note("Note: Entries are coefficients from OLS regressions. Standard errors clustered at the municipal level in parenthesis. + p<0.1; * p<0.05; ** p<0.01; *** p<0.001")  ///
       stats(N munfe yearfe controls timeperiod, fmt(%9.0g) labels("N" "Municipal FE" "Year FE" "Controls" "Time Period")) ///
	   starlevels(+ 0.1 * 0.05 ** 0.01 *** 0.001) ///
	   o(number_cartels lag1_homrate mpoff1000) compress fonttbl(\f0\fnil Garamond; ) ///
	   varlabels(number_cartels "Number of cartels" lag1_homrate "Homicide rate (t-1)" mpoff1000 "Prosecutors per 100,000") ///
	   title("Table A.VIII.b. The Impact of Cartel Fragmentation on Journalists' Murders by Mexican Municipality, 1994–2010") replace


********** Table A.VIII.d
** Effect of fragmentation on politicians assassinated
eststo clear
* OLS FE
eststo: reghdfe aggr_sum number_cartels lag1_homrate mpoff1000, cluster(cve_inegi) absorb(cve_inegi year)
	estadd local munfe  "Y" 
	estadd local yearfe  "Y"
	estadd local mod  "OLS"
	estadd local controls  "Y"
	estadd local timeperiod "2007-2010"

* NB RE
eststo: xtnbreg aggr_sum number_cartels lag1_homrate mpoff1000, i(cve_inegi) re irr
	estadd local munfe  "" 
	estadd local yearfe  ""
	estadd local mod  "Neg. Bin."
	estadd local controls  "Y"
	estadd local timeperiod "2007-2010"
	
esttab using "Table A.VIII.d.rtf", cell(b(star fmt (%9.2f)) se(par))  ///
       uns keep(number_cartels) mtitle(OLS "Neg. Bin.") ///
	   note("Note: Standard errors clustered at the municipal level in parenthesis. Models control for municipal taxation, prosecutors per 1,000 population, municipal and state alternation, and the municipal and state effective number of parties (ENP). + p<0.1; * p<0.05; ** p<0.01; *** p<0.001")  ///
       stats(N munfe yearfe controls timeperiod, fmt(%9.0g) labels("N" "Municipal FE" "Year FE" "Controls" "Time Period")) ///
	   starlevels(+ 0.1 * 0.05 ** 0.01 *** 0.001) ///
	   o(number_cartels) ///
	   varlabels(number_cartels "Number of Cartels" aggr_sum "Journalists murdered (count)") ///
	   title("Table A.VIII.d. Cartel Fragmentation and High-Profile Criminal Attacks in Mexican  Municipalities") replace


********** Table A.VIII.e
**** Table A.VI.e
** Effect of inter-cartel wars on politicians assassinated
eststo clear
* OLS FE
eststo: reghdfe aggr_sum cvmr1000dummy lag1_homrate mpoff1000 , cluster(cve_inegi) absorb(cve_inegi year)
	estadd local munfe  "Y" 
	estadd local yearfe  "Y"
	estadd local mod  "OLS"
	estadd local controls  "Y"
	estadd local timeperiod "2007-2012"

* NB RE
eststo: xtnbreg aggr_sum cvmr1000dummy lag1_homrate mpoff1000, i(cve_inegi) re
	estadd local munfe  "" 
	estadd local yearfe  ""
	estadd local mod  "Neg. Bin."
	estadd local controls  "Y"
	estadd local timeperiod "2007-2012"

esttab using "Table A.VIII.e.rtf", cell(b(star fmt (%9.2f)) se(par))  ///
       uns keep(cvmr1000dummy) mtitle(OLS "Neg. Bin.") ///
	   note("Note: Standard errors clustered at the municipal level in parenthesis. Models control for municipal taxation, prosecutors per 1,000 population, municipal and state alternation, and the municipal and state effective number of parties (ENP). + p<0.1; * p<0.05; ** p<0.01; *** p<0.001")  ///
       stats(N munfe yearfe controls timeperiod, fmt(%9.0g) labels("N" "Municipal FE" "Year FE" "Controls" "Time Period")) ///
	   starlevels(+ 0.1 * 0.05 ** 0.01 *** 0.001) ///
	   o(number_cartels) ///
	   varlabels(cvmr1000dummy "Inter-Cartel Wars (dummy)") ///
	   title("Table A.VIII.e. Inter-Cartel Wars and High-Profile Criminal Attacks in Mexican Municipalities") replace

********** Table A.VIII.f
eststo clear
* OLS FE
eststo: reghdfe aggr_sum decap_jcr_dummy lag1_homrate mpoff1000, cluster(cve_inegi) absorb(cve_inegi year)
	estadd local munfe  "Y" 
	estadd local yearfe  "Y"
	estadd local mod  "OLS"
	estadd local controls  "Y"
	estadd local timeperiod "2007-2010"


* NB RE
eststo: xtnbreg aggr_sum decap_jcr_dummy lag1_homrate mpoff1000, i(cve_inegi) re
	estadd local munfe  "" 
	estadd local yearfe  ""
	estadd local mod  "Neg. Bin."
	estadd local controls  "Y"
	estadd local timeperiod "2007-2010"

	
esttab using "Table A.VIII.f.rtf", cell(b(star fmt (%9.2f)) se(par))  ///
       uns keep(decap_jcr_dummy) mtitle(OLS "Neg. Bin.") ///
	   note("Note: Standard errors clustered at the municipal level in parenthesis. Models control for municipal taxation, prosecutors per 1,000 population, municipal and state alternation, and the municipal and state effective number of parties (ENP). + p<0.1; * p<0.05; ** p<0.01; *** p<0.001")  ///
       stats(N munfe yearfe controls timeperiod, fmt(%9.0g) labels("N" "Municipal FE" "Year FE" "Controls" "Time Period")) ///
	   starlevels(+ 0.1 * 0.05 ** 0.01 *** 0.001) ///
	   o(decap_jcr_dummy) ///
	   varlabels(decap_jcr_dummy "Decapitation" aggr_sum "Journalists murdered (count)") ///
	   title("Table A.VI.f. The Impact of Decapitation on High-profile Criminal Attacks by Mexican Municipality") replace